home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F18834_PremiershipStats.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2002-04-14  |  1.9 KB  |  63 lines

  1. <?xml version="1.0"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3. <xsl:output method="html" encoding="ISO-8859-1" indent="yes"/>
  4.  
  5. <xsl:key name="kDistinctScorers" match="scorer[not(@type) or (@type and @type != 'og')]" use="concat(parent::*/@team,'||',@name)"/>
  6.  
  7. <xsl:template match="/">
  8.     <html>
  9.         <head>
  10.             <title>
  11.                 <xsl:value-of select="/results/@nation"/>
  12.                 <xsl:text> </xsl:text>
  13.                 <xsl:value-of select="/results/@sponsor"/>
  14.                 <xsl:text> </xsl:text>
  15.                 <xsl:value-of select="/results/@league"/>
  16.                 <xsl:text> (stats)</xsl:text>
  17.             </title>
  18.         </head>
  19.         <body>
  20.             <h3>
  21.                 <xsl:value-of select="/results/@nation"/>
  22.                 <xsl:text> </xsl:text>
  23.                 <xsl:value-of select="/results/@sponsor"/>
  24.                 <xsl:text> </xsl:text>
  25.                 <xsl:value-of select="/results/@league"/>
  26.                 <xsl:text> (stats)</xsl:text>
  27.             </h3>
  28.             <hr/>
  29.             <h4>
  30.                 <xsl:text>Leading Goal Scorers</xsl:text>
  31.             </h4>
  32.             <table border="1">
  33.                 <tr>
  34.                     <th>Player</th>
  35.                     <th>Team</th>
  36.                     <th>Goals</th>
  37.                     <th>Pens</th>
  38.                 </tr>
  39.                 <xsl:apply-templates select="results/result/*/scorer[not(@type) or (@type and @type != 'og')][generate-id() = generate-id(key('kDistinctScorers',concat(parent::*/@team,'||',@name)))]" mode="leading-scorers">
  40.                     <xsl:sort select="count(key('kDistinctScorers',concat(parent::*/@team,'||',@name)))" data-type="number" order="descending"/>
  41.                 </xsl:apply-templates>
  42.             </table>
  43.         </body>
  44.     </html>
  45. </xsl:template>
  46.  
  47. <xsl:template match="scorer" mode="leading-scorers">
  48.     <tr>
  49.         <td>
  50.             <xsl:value-of select="@name"/>
  51.         </td>
  52.         <td>
  53.             <xsl:value-of select="parent::*/@team"/>
  54.         </td>
  55.         <td align="right">
  56.             <xsl:value-of select="count(key('kDistinctScorers',concat(parent::*/@team,'||',@name)))"/>
  57.         </td>
  58.         <td align="right">
  59.             <xsl:value-of select="count(key('kDistinctScorers',concat(parent::*/@team,'||',@name))[@type = 'pen'])"/>
  60.         </td>
  61.     </tr>
  62. </xsl:template>
  63. </xsl:stylesheet>